import Vue from 'vue'
import VueRouter from 'vue-router'

import Index from "../views/index/Index";

import GoodsDetail from "../views/goods_detail/GoodsDetail";

import Login from "../views/login/Login";

import Register from "../views/register/Register";

import UserIndex from "../views/user/User"
/**引入二级路由*/
import UserInfo from "../views/user/childComps/info/Info"
import Car from "../views/user/childComps/car/Car"
import Order from "../views/user/childComps/order/order_list/Order"
import UserOrderDetail from "../views/user/childComps/order/order_detail/OrderDetail"
import UserGoods from "../views/user/childComps/goods/goods_list/Goods"
import UserAddGoods from "../views/user/childComps/goods/good_add/GoodAdd"
import UserAlterGoods from "../views/user/childComps/goods/good_alter/GoodsAlter"
import UserCategory from "../views/user/childComps/category/category_list/Category"
import UserAddCategory from "../views/user/childComps/category/category_add/CategoryAdd"
import UserRecharge from "../views/user/childComps/recharge/Recharge"

import AdminIndex from '../views/admin/Index'
/**引入二级路由*/
import AdminIntroduce from "../views/admin/childComps/introduce/Introduce";
import AdminUser from '../views/admin/childComps/user/user_list/User'
import AdminUserAdd from '../views/admin/childComps/user/user_add/UserAdd'
import AdminUserAlter from '../views/admin/childComps/user/user_alter/UserAlter'
import AdminCategory from '../views/admin/childComps/category/category_list/Category'
import AdminCategoryAdd from '../views/admin/childComps/category/category_add/CategoryAdd'
import AdminGoods from '../views/admin/childComps/goods/goods_list/Goods'
import AdminGoodsAdd from '../views/admin/childComps/goods/good_add/GoodAdd'
import AdminGoodsAlter from '../views/admin/childComps/goods/good_alter/GoodsAlter'
import AdminOrder from "../views/admin/childComps/order/order_list/Order";
import AdminOrderDetail from "../views/admin/childComps/order/order_detail/OrderDetail"
import AdminTransaction from "../views/admin/childComps/transaction/transaction_list/Transaction"
import AdminMessage from '../views/admin/childComps/message/message_list/Message'


import TestUpload from "../views/test/TestUpload";

Vue.use(VueRouter)

const routes = [
  {
    path: '/test',
    component: TestUpload
  },
  {
    path: '',
    redirect: 'index'
  },
  {
    path: '/index',
    component: Index
  },
  {
    path: '/goods_detail',
    name: 'ShowGoodsDetail',
    component: GoodsDetail,
  },
  {
    path: '/login',
    component: Login
  },
  {
    path: '/register',
    component: Register
  },
  {
    path: '/user',
    component: UserIndex,
    redirect: '/user/info',
    children: [
      {
        path: '/user/info',
        component: UserInfo,
      },
      {
        path: '/user/car',
        component: Car,
      },
      {
        path: '/user/order',
        component: Order,
      },
      {
        path: '/user/order-detail',
        name: 'UserToOrderDetail',
        component: UserOrderDetail,
      },
      {
        path: '/user/goods',
        component: UserGoods,
      },
      {
        path: '/user/goods/add',
        component: UserAddGoods,
      },
      {
        path: '/user/goods/alter',
        name: 'UserToGoodsAlter',
        component: UserAlterGoods,
      },
      {
        path: '/user/category',
        component: UserCategory,
      },
      {
        path: '/user/category/add',
        name: 'UserToAddCategory',
        component: UserAddCategory,
      },
      {
        path: '/user/recharge',
        component: UserRecharge,
      },
    ]
  },
  {
    path: '/admin',
    component: AdminIndex,
    redirect: '/admin/introduce',
    children: [
      {
        path: '/admin/introduce',
        component: AdminIntroduce
      },

      {
        path: '/admin/user',
        component: AdminUser,
      },
      {
        path: '/admin/user/add',
        component: AdminUserAdd,
      },
      {
        path: '/admin/user/alter',
        name: 'AdminToUserAlter', // params方式跳转路由需要使用name属性值
        component: AdminUserAlter,
      },

      {
        path: '/admin/category',
        component: AdminCategory
      },
      {
        path: '/admin/category/add',
        name: 'AdminToCategoryAdd',
        component: AdminCategoryAdd,
      },
      {
        path: '/admin/goods',
        component: AdminGoods,
      },
      {
        path: '/admin/good/add',
        component: AdminGoodsAdd,
        name: 'AdminToGoodAdd'
      },
      {
        path: '/admin/good/alter',
        component: AdminGoodsAlter,
        name: 'AdminToGoodsAlter'
      },
      {
        path: '/admin/order',
        component: AdminOrder,
      },
      {
        path: '/admin/order-detail',
        name: 'AdminToOrderDetail',
        component: AdminOrderDetail,
      },
      {
        path: '/admin/transaction',
        component: AdminTransaction,
      },
      {
        path: '/admin/message',
        component: AdminMessage
      }
    ]
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL, // 本地测试使用该路由配置
  // base: '/sale_puma/', // 发布到Tomcat服务器时要使用该路由配置，主要该配置要与tomcat服务器下的目录一致
  routes
})

export default router



// 136513782802021005006010042034.png' -> 'static/upload/user/1365137828/136513782802021005006010042034.png
